#include <wiringPi.h>
#include <softPwm.h>
#include <stdio.h>
#define uchar unsigned char
#define LedPinRed 0
#define LedPinGreen 1

void led_init(void)
{
    softPwmCreate(LedPinRed,0,100);
    softPwmCreate(LedPinGreen,0,100);
}

void led_color(uchar r,uchar g)
{
    softPwmWrite(LedPinRed,r);
    softPwmWrite(LedPinGreen,g);
}

int main(void)
{
    int i;
    if(wiringPiSetup() == -1){
        printf("setup wiringPi failed !");
        return 1;
    }
    led_init();
    while(1){
        led_color(0xff, 0x00);
        delay(500);
        led_color(0x00, 0xff);
        delay(500);
        led_color(0x00, 0x45);
        delay(500);
        led_color(0xff, 0xff);
        delay(500);
        led_color(0x7c, 0xfc);
        delay(500);
    }
    return 0;
}